package org.example.javassistPro;

import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;

import java.io.IOException;

/**
 * @author : yuhuan.wu
 * @date : 2021/11/1
 * @description :
 */
public class Attacher {


    public static void main(String[] args) throws AttachNotSupportedException, IOException, AgentLoadException, AgentInitializationException {
        // 传入目标 JVM pid
        VirtualMachine vm = VirtualMachine.attach("30256");
        vm.loadAgent("D:\\GOWORK\\MyAllProject\\agent-demo\\target\\agent-demo-1.0-SNAPSHOT.jar","org.example.Base");
    }


}
